<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
</head>
<body>
<form >
    <input type="text" name="keywordone" placeholder="请输入商品名称">
    <input type="text" name="keywordtwo" placeholder="请输入商品分类">
    <input type="submit" value="搜索">
</form>
<table class="table">
   <tr>
       <th>id</th>
       <th>名称</th>
       <th>图片</th>
       <th>分类</th>
       <th>操作</th>
   </tr>
    {foreach $data as $k=>$v}
    <tr>
        <td>{$v.id}</td>
        <td>{$v.name}</td>
        <td><img src="{$v.img}" width="80px"></td>
        <td>{$v.class}</td>
        <td>
            <a href="info?id={$v.id}">详情</a>
            <button class="btn-primary one" id="{$v.id}">删除</button>
        </td>
    </tr>
    {/foreach}
</table>
{$data|raw}
</body>
<script src="/static/js/jquery-3.1.1.min.js"></script>
<script>
    $(function () {
          $('.one').click(function () {
               var  id=$(this).attr('id');
              console.log(id);
              $.get(
                  'del?id='+id,
                  function (data) {
                      console.log(data);
                      if (data.code==200){
                          alert('删除成功');
                          location.href='show';
                      }else {
                          alert('删除shibai');

                      }
                  }
              )

          })
    })
</script>
</html>